<?php 
namespace app\index\controller;

use think\Controller;

class Fen extends Controller
{
	public function fen()
	{
		$page=request()->get('page',10);
		$limit=request()->get('limit',1);
		$where=[];
		$res=model('Ding')->getlist($where,$page,$limit);
		if(!$res)
		{
			$arr['code']=1;
			$arr['msg']='no';
			$arr['data']='';
			return json($arr);
		}
		$arr['code']=0;
		$arr['msg']='yes';
		$arr['data']=$res;
		return json($arr);
	}
	public function del()
	{
		$id=request()->delete('id','');
		$res=model('Ding')->dels($id);
		if(!$res)
		{
			$arr['code']=1;
			$arr['msg']='删除失败,请管理员添加记录';
			$arr['data']='';
			return json($arr);
		}
		$arr['code']=0;
		$arr['msg']='删除成功';
		$arr['data']='';
		return json($arr);
	}
}
 ?>